package com.example.jenkinsdemo.controller;

import com.example.jenkinsdemo.model.User;
import com.example.jenkinsdemo.service.UserMapper;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <br>
 *
 * <p>- <br>
 *
 * @author shenhan
 * @version 1.0
 * @date: 2023/12/7
 * @description:
 */
@RestController
@RequestMapping("/api/v1")
public class DemoController {
    @Resource
    private UserMapper userMapper;

    @RequestMapping("/getUsers")
    public List<User> getUsers() {
        return userMapper.selectList(null);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/getEmail")
    public String getEmail() {
        return userMapper.selectList(null).stream().findFirst().map(User::getEmail).get();
    }
}
